home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
boosters.arc
/
CENTER.ASM
< prev
next >
Wrap
Assembly Source File
|
1980-01-01
|
1KB
|
58 lines
;**********************************************************************
; type
; AnyString = string[255];
; var
; C : char;
; N : integer;
;
; Function center(S : AnyString; N : integer; C : Char); AnyString;
; external 'B:center';
;**********************************************************************
center proc near
push bp
mov bp,sp
push ds
lea si,[bp+9] ; first character of string to center
lea bx,[bp+264] ; length byte of centered string
mov cx,[bp+6] ; get N
mov ss:[bx],cl ; set length of centered string
inc bx
mov cl,[bp+8] ; length of string to center
xor ch,ch
mov ax,[bp+6] ; get N again
sub ax,cx
ja cen1
xor ax,ax
jmp cen2
;
cen1: shr ax,1
push ax
mov di,bx
mov ax,[bp+4]
mov cx,[bp+6]
push ss
pop es
cld
rep stosb
pop ax
;
cen2: add bx,ax
mov di,bx
push ss
pop ds
mov cl,[bp+8] ; length of string to center
xor ch,ch
cld
rep movsb
;
pop ds
mov sp,bp
pop bp
pop bx
mov ax,cs:[bx]
cmp ax,0FFB1h
jnz cen3
add bx,5
cen3: push bx
ret 260
center endp